package shop.up.item.controller;

import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import shop.up.common.result.Result;
import shop.up.item.service.ItemService;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author zzc
 * @date 2023/4/2 15:03
 */
@RestController
@RequestMapping("api/item")
public class ItemApiController {

    @Resource
    private ItemService itemService;

    /**
     * 获取sku详情信息
     *
     * @param skuId
     * @return
     */
    @ApiOperation("获取sku详情信息")
    @GetMapping("{skuId}")
    public Result<Map<String,Object>> getItem(@PathVariable("skuId") Long skuId) {
        Map<String, Object> result = itemService.getBySkuId(skuId);
        // System.out.println(result);
        return Result.ok(result);
    }
}
